package com.kanesoft.android.gdx.actors.fight;

import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.InputAdapter;

public class ControlActorFightKeyboardP2 extends InputAdapter   {

    private FightActorObject controlledActor;
    
    public ControlActorFightKeyboardP2(FightActorObject controlledActor) {
        this.controlledActor = controlledActor;
    }

    @Override
    public boolean keyDown(int keycode) {
        if (keycode == Keys.J) {
            if (controlledActor.getHorizontalFlip() == true) {
                controlledActor.doActionWalkingForward();    
            } else {
                controlledActor.doActionWalkingBackward();
            }
        }
        
        if (keycode == Keys.L) {
            if (controlledActor.getHorizontalFlip() == false) {
                controlledActor.doActionWalkingForward();    
            } else {
                controlledActor.doActionWalkingBackward();
            }
        }
        
        if (keycode == Keys.K) controlledActor.doActionKick();
        if (keycode == Keys.I) controlledActor.doActionJump();
        if (keycode == Keys.M) controlledActor.doActionPunch();
        if (keycode == Keys.H) controlledActor.doActionThrowFireball();

        return false;
    }

    @Override
    public boolean keyUp(int keycode) {
        if (keycode == Keys.L) controlledActor.doActionWaiting();
        if (keycode == Keys.J) controlledActor.doActionWaiting();
        return false;
    }

}
